<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ViewUsinaTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">

            <!--<h:form prependId="false">-->
            <p:growl id="messages" life="3000"/>

            <h:panelGroup id="messagePanel" styleClass="ajustaListaMensagemErro"  layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="list"/>
            </h:panelGroup>
            <p:panel>
                <f:facet name="header">
                    <h:outputText value="#{bundle.LegendUsinaTitle}"></h:outputText>
                </f:facet>
                <h:panelGrid columns="2">
                    <h:outputText value="#{bundle.ViewUsinaLabel_usiId}"/>
                    <h:outputText value="#{usinaController.selected.usiId}" title="#{bundle.ViewUsinaTitle_usiId}"/>

                    <h:outputText value="#{bundle.ViewUsinaLabel_usiProcesso}"/>

                    <h:outputLink styleClass="formataLink"  target="new"  id="linkProcesso" value="#{usinaController.pesquisaProcesso()}"  >
                        <h:outputText value="#{usinaController.selected.usiProcesso}" converter="inputConverter" title="#{bundle.ListControleDocumentoTitle_usiProcesso}"/> 
                    </h:outputLink>                     

                    <h:outputText value="#{bundle.ViewUsinaLabel_uslOrgao}"/>
                    <h:outputText value="#{usinaController.selected.usiOrgId.orgNm}" title="#{bundle.ViewUsinaTitle_uslOrgao}"/>                   

                    <h:outputText value="#{bundle.ViewUsinaLabel_usiNm}"/>
                    <h:outputText value="#{usinaController.selected.usiNm}" title="#{bundle.ViewUsinaTitle_usiNm}"/>                    

                    <h:outputText value="#{bundle.ViewUsinaLabel_usiAtoLegal}"/>
                    <h:outputText value="#{usinaController.selected.valorAtoLegal}"  title="#{bundle.ViewUsinaTitle_usiAtoLegal}"/> 

                    <h:outputText value="#{bundle.ViewUsinaLabel_usiNuAreaDrenagem}"/>
                    <h:panelGroup>
                        <h:outputText value="#{usinaController.selected.usiNuAreaDrenagem}" title="#{bundle.ViewUsinaTitle_usiNuAreaDrenagem}">
                            <f:convertNumber locale="#{bundle.localeApp}" maxFractionDigits="#{bundle.maxFractionDigits}" minFractionDigits="#{bundle.minFractionDigits}"/>
                        </h:outputText> <h:outputText value=" #{bundle.KM2}" rendered="#{usinaController.selected.usiNuAreaDrenagem!=null}"/> 
                    </h:panelGroup>
                    <h:outputText value="#{bundle.ViewUsinaLabel_usiNuAreaIncremental}"/>
                    <h:panelGroup>
                        <h:outputText value="#{usinaController.selected.usiNuAreaIncremental}" title="#{bundle.ViewUsinaTitle_usiNuAreaIncremental}">
                            <f:convertNumber locale="#{bundle.localeApp}" maxFractionDigits="#{bundle.maxFractionDigits}" minFractionDigits="#{bundle.minFractionDigits}"/>
                        </h:outputText> <h:outputText value=" #{bundle.KM2}" rendered="#{usinaController.selected.usiNuAreaIncremental!=null}"/>
                    </h:panelGroup>
                    <h:outputText value="#{bundle.ViewUsinaLabel_usiNuAreaInundada}"/>
                    <h:panelGroup>
                        <h:outputText value="#{usinaController.selected.usiNuAreaInundada}" title="#{bundle.ViewUsinaTitle_usiNuAreaInundada}">
                            <f:convertNumber locale="#{bundle.localeApp}" maxFractionDigits="#{bundle.maxFractionDigits}" minFractionDigits="#{bundle.minFractionDigits}"/>
                        </h:outputText> <h:outputText value=" #{bundle.KM2}" rendered="#{usinaController.selected.usiNuAreaInundada!=null}"/>
                    </h:panelGroup>
                    <h:outputText value="#{bundle.ViewUsinaLabel_usiNuPotencia}"/>
                    <h:panelGroup>
                        <h:outputText value="#{usinaController.selected.usiNuPotencia}" title="#{bundle.ViewUsinaTitle_usiNuPotencia}">
                            <f:convertNumber locale="#{bundle.localeApp}" maxFractionDigits="#{bundle.maxFractionDigits}" minFractionDigits="#{bundle.minFractionDigits}"/>
                        </h:outputText> <h:outputText value=" #{bundle.MW}" rendered="#{usinaController.selected.usiNuPotencia!=null}"/>
                    </h:panelGroup>

                    <h:outputText value="#{bundle.ViewUsinaLabel_usiLatitude}"/>
                    <h:outputText value="#{usinaController.selected.usiLatitude}">
                        <f:converter converterId="latLong" />
                    </h:outputText>

                    <h:outputText value="#{bundle.ViewUsinaLabel_usiLongitude}"/>
                    <h:outputText value="#{usinaController.selected.usiLongitude}">
                        <f:converter converterId="latLong" />
                    </h:outputText>

                    <h:outputText value="#{bundle.ViewUsinaLabel_usiTpuId}"/>
                    <h:outputText value="#{usinaController.selected.usiTpuId.tpuNm}" title="#{bundle.ViewUsinaTitle_usiTpuId}"/>

                    <h:outputText value="#{bundle.ViewUsinaLabel_usiSituacao}"/>
                    <h:outputText value="#{usinaController.selected.usiUssId.ussNm}" title="#{bundle.ViewUsinaTitle_usiSituacao}"/>

                    <h:outputLabel value="#{bundle.ViewUsinaLabel_usiDtaProjeto}" rendered="#{usinaController.emOperacao}"/>
                    <h:outputText value="#{usinaController.selected.usiDtaOperacao}" rendered="#{usinaController.emOperacao}" title="#{bundle.ViewUsinaTitle_usiDtaProjeto}">
                        <f:convertDateTime pattern="#{bundle.patternApp}" locale="#{bundle.localeApp}" timeZone="#{filterSearchController.timeZone}"/>
                    </h:outputText>

                    <h:outputText value="#{bundle.ViewUsinaLocalizacaoLabel_uslUfdCd}"/>
                    <h:outputText value="#{usinaController.selected.siglaUf} " title="#{bundle.ViewUsinaLocalizacaoTitle_uslUfdCd}"/>                            

                    <h:outputText value="#{bundle.ViewUsinaLocalizacaoLabel_uslMunCd}"/>                            
                    <h:outputText value="#{usinaController.selected.municipioNm}" />

                    <h:outputText value="#{bundle.EditUsinaLabel_usiTxEndereco}"/>
                    <h:outputText value="#{usinaController.selected.usiTxEndereco}" title="#{bundle.EditUsinaTitle_usiTxEndereco}"/> 

                    <h:outputText value="#{bundle.EditUsinaLabel_usiTxCep}"/>
                    <h:outputText value="#{usinaController.selected.usiTxCep}" converter="inputConverter" title="#{bundle.EditUsinaTitle_usiTxCep}"/> 

                    <h:outputText value="#{bundle.ViewUsinaLabel_usiDnsCd}"/>
                    <h:outputText value="#{usinaController.selected.usiSbcCodigo.sbcNome}" title="#{bundle.ViewUsinaTitle_usiDnsCd}"/>

                    <h:outputText value="#{bundle.ViewUsinaLocalizacaoLabel_uslRioCd}"/>
                    <h:outputText value="#{usinaController.usinaLocalizacao.uslRioCodigo.toString()}" title="#{bundle.ViewUsinaLocalizacaoTitle_uslRioCd}"/>

                    <h:outputText value="#{bundle.ViewUsinaLabel_usiTxObservacao}"/>
                    <h:outputText value="#{usinaController.selected.usiTxObservacao}" title="#{bundle.ViewUsinaLabel_usiTxObservacao}"/> 

                    <h:outputLabel value="#{bundle.UsinaTecnicoDialogTargetCaption}" for="usiTecnicos"/>
                    <p:dataList id="usiTecnicos" value="#{usinaController.tecnicosRelacionados}" var="item" paginator="true" currentPageReportTemplate="P&aacute;gina {currentPage}/{totalPages} de {totalRecords} t&eacute;cnicos(s)." paginatorPosition="bottom" rows="10" rowsPerPageTemplate="10" type="none" 
                                paginatorTemplate="{PreviousPageLink} {CurrentPageReport} {NextPageLink} {RowsPerPageDropdown}">
                        <h:outputText value="#{item.tecNm} (#{item.tecEmail})" style="margin-left:10px" />                        
                        <br />
                    </p:dataList>  

                    <h:outputLabel value="#{bundle.createBy}" for="nomeCriador" rendered="#{not empty usinaController.selected.historicoCriacao.nomeUsuario}"/>
                    <h:outputText id="nomeCriador" value="#{usinaController.selected.historicoCriacao.nomeUsuario}" rendered="#{not empty usinaController.selected.historicoCriacao.nomeUsuario}"/>
                    <h:outputLabel value="#{bundle.createDate}" for="dataCriacao" rendered="#{not empty usinaController.selected.historicoCriacao.dataHora}"/>
                    <h:outputText id="dataCriacao" value="#{usinaController.selected.historicoCriacao.dataHora}" rendered="#{not empty usinaController.selected.historicoCriacao.dataHora}"/>     
                    <h:outputLabel value="#{bundle.updateBy}" for="nomeAlterador" rendered="#{not empty usinaController.selected.historicoAlteracao.nomeUsuario}"/>
                    <h:outputText id="nomeAlterador" value="#{usinaController.selected.historicoAlteracao.nomeUsuario}" rendered="#{not empty usinaController.selected.historicoAlteracao.nomeUsuario}"/>
                    <h:outputLabel value="#{bundle.updateDate}" for="dataAlteracao" rendered="#{not empty usinaController.selected.historicoAlteracao.dataHora}"/>
                    <h:outputText id="dataAlteracao" value="#{usinaController.selected.historicoAlteracao.dataHora}" rendered="#{not empty usinaController.selected.historicoAlteracao.dataHora}" />

                </h:panelGrid>
                <br/>
                <p:commandButton id="deleteCommand" rendered="#{autenticadorController.loginAdmin}"  onclick="confirmationDestroy.show();" value="#{bundle.ViewUsinaDestroyLink}" type="button" icon="#{bundle.icone_lixeira}" />&nbsp;
                <p:commandButton ajax="false" rendered="#{!autenticadorController.loginVisualizador}" icon="#{bundle.icone_pencil}" action="Edit" value="#{bundle.ViewUsinaEditLink}"/>&nbsp;
                <p:commandButton ajax="false" action="#{usinaController.prepareList}" icon="#{bundle.icone_listar}" value="#{bundle.ViewUsinaShowAllLink}"/>                    
                <p:commandButton ajax="false" action="#{usinaController.prepareListaInativos}" value="#{bundle.ViewUsinaShowAllLinkInativos}" immediate="true"/> &nbsp;
                <p:commandButton ajax="false" action="#{usinaController.prepareListaSemTecnico}" value="#{bundle.ViewUsinaShowAllLinkSemTecnico}" immediate="true"/> &nbsp;

            </p:panel>

            <p:confirmDialog id="confirmDestroy" message="#{bundle.MsgConfirmDestroy_message}" header="#{bundle.MsgConfirmDestroy_header}" severity="alert" widgetVar="confirmationDestroy">
                <p:commandButton id="confirm" ajax="false" value="#{bundle.MsgDialog_confirmar}"  oncomplete="confirmationDestroy.hide();" action="#{usinaController.destroy}" />
                <p:commandButton id="decline"  value="#{bundle.MsgDialog_cancelar}" update="messages" onclick="confirmationDestroy.hide();" type="button"/>
            </p:confirmDialog>
            <!--</h:form>-->
        </ui:define>
    </ui:composition>

</html>
